<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class TakeOrderRecModel extends BaseModel
{
    use HasFactory;

    protected $table = 't_take_order_rec';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    protected $guarded = [];

    protected $hidden = [];

    //1空运费 2提单费 3分单费 4补录
    const TYPE_FLIGHT = 1;
    const TYPE_TAKE = 2;
    const TYPE_SPLIT = 3;
    const TYPE_OTHER = 4;
    const TYPE_MAPS = [
        self::TYPE_FLIGHT => '空运费',
        self::TYPE_TAKE => '提单费',
        self::TYPE_SPLIT => '分单费',
        self::TYPE_OTHER => '补录'
    ];


    public function create_admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'created_admin_id');
    }

}
